package cn.youqu.happy.module.youqu.dal.mysql.systemHobby;

import java.util.*;

import cn.youqu.happy.framework.common.pojo.PageResult;
import cn.youqu.happy.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.youqu.happy.framework.mybatis.core.mapper.BaseMapperX;
import cn.youqu.happy.module.youqu.dal.dataobject.systemHobby.SystemHobbyDO;
import org.apache.ibatis.annotations.Mapper;
import cn.youqu.happy.module.youqu.controller.admin.systemHobby.vo.*;

/**
 * 系统爱好 Mapper
 *
 * @author 王其岩 20112001045
 */
@Mapper
public interface SystemHobbyMapper extends BaseMapperX<SystemHobbyDO> {

    default PageResult<SystemHobbyDO> selectPage(SystemHobbyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SystemHobbyDO>()
                .eqIfPresent(SystemHobbyDO::getImg, reqVO.getImg())
                .eqIfPresent(SystemHobbyDO::getLabel, reqVO.getLabel())
                .eqIfPresent(SystemHobbyDO::getDetail, reqVO.getDetail())
                .betweenIfPresent(SystemHobbyDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .eqIfPresent(SystemHobbyDO::getRemark, reqVO.getRemark())
                .orderByDesc(SystemHobbyDO::getId));
    }

    default List<SystemHobbyDO> selectList(SystemHobbyExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<SystemHobbyDO>()
                .eqIfPresent(SystemHobbyDO::getImg, reqVO.getImg())
                .eqIfPresent(SystemHobbyDO::getLabel, reqVO.getLabel())
                .eqIfPresent(SystemHobbyDO::getDetail, reqVO.getDetail())
                .betweenIfPresent(SystemHobbyDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .eqIfPresent(SystemHobbyDO::getRemark, reqVO.getRemark())
                .orderByDesc(SystemHobbyDO::getId));
    }

}
